<?php

Route::get('orderhome', function() {
    return view('Home/goods-order');
})->name('orderhome');

Route::get('orderdetail', function() {
    return view('Home/goods-order_detail');
})->name('orderdetail');


Route::get('linkstest', 'Home\OrderAddressController@linkstest');
//以上为测试路由
Route::get('cartnum', 'Home\ShopCartController@showCartNumber');//这个方法查询了redis中用户的购物车，数据是为了在页头显示购物车的商品种类

Route::post('orderaddresscreate', 'Home\OrderAddressController@create')->name('orderaddresscreate');


//用户在详情页加入购物车时通过AJAX传递属性id和数量给后台
Route::post('addtocart', 'Home\ShopCartController@addToCart')->name('addtocar');

//点击购物车图标进入购物车页面->middleware('homeauth')
Route::get('showcart','Home\ShopCartController@index')->name('showcart');

//处理用户删除购物车的商品
Route::get('deletecartgoods', 'Home\ShopCartController@destroy')->name('deletecartgoods');

//处理用户加加购物车的商品
Route::get('cartgoodsadd', 'Home\ShopCartController@addNum')->name('cartgoodsadd');

//处理用户减减购物车的商品
Route::get('cartgoodscut', 'Home\ShopCartController@cutNum')->name('cartgoodscut');

//处理用户在购物车页面点击结算，如果没登录就跳回到登录
Route::get('account', 'Home\OrderAddressController@getCartGoods')->name('account');

//处理用户在购物车选好心仪商品后进入确认订单的页面
Route::get('confirm', 'Home\OrderAddressController@index')->name('confirm')->middleware('homeauth');

//处理用户购买热销商品，直接从详情页面跳转到确认订单页面
Route::post('confirmsale', 'Home\OrderAddressController@confirmSale')->name('confirmsale');

//促销商品从详情页到控制器
Route::get('saleorder', 'Home\OrderAddressController@saleOrder')->name('saleorder')->middleware('homeauth');

//促销商品的确认订单,提取用户的留言和商品属性id,准备放入订单
Route::post('createsaleorder', 'Home\OrderAddressController@createSaleOrder')->name('createsaleorder')->middleware('homeauth');

//处理显示用户核对订单的页面
Route::get('orderhome', 'Home\OrderAddressController@show')->name('orderhome')->middleware('homeauth');

//处理用户在确认订单界面ajax删除地址
Route::post('deleteaddress', 'Home\OrderAddressController@deleteAddress')->name('deleteaddress')->middleware('homeauth');

//处理用户在确认订单界面AJAX编辑收货地址
Route::post('editaddress', 'Home\OrderAddressController@editAddress')->name('editaddress')->middleware('homeauth');

//处理用户在订单页面修改地址的默认状态
Route::get('defaultaddress', 'Home\OrderAddressController@defaultAddress')->name('defaultaddress')->middleware('homeauth');

//处理用户确认收货信息后提交的订单
Route::post('createOrder', 'Home\OrderAddressController@createOrder')->name('createorder')->middleware('homeauth');

//用户下单成功准备支付
Route::post('orderpay', 'Home\OrderAddressController@orderPay')->name('orderpay')->middleware('homeauth');

//用户查看自己的订单
Route::get('orderlist', 'Home\UserOrderController@index')->name('orderlist')->middleware('homeauth');

//用户在订单列表对未支付的订单进行立即支付
Route::post('orderlistpay', 'Home\UserOrderController@orderPay')->name('orderlistpay')->middleware('homeauth');

//用户在订单列表页面取消订单
Route::post('ordercancel', 'Home\UserOrderController@orderCancel')->name('ordercancel')->middleware('homeauth');

//用户在订单列表页面删除已经取消的订单
Route::post('orderdel', 'Home\UserOrderController@orderDel')->name('orderdel')->middleware('homeauth');

// 用户在订单列表点击查看订单详情
Route::get('orderdetail/{oid}', 'Home\UserOrderController@orderDetail')->name('orderdetail')->middleware('homeauth');

//用户在订单列表确认收货
Route::post('confirmget', 'Home\UserOrderController@confirmGet')->name('confirmget')->middleware('homeauth');;











//
